import java.util.ArrayList;
import java.util.List;

public class test1 {
    public static void main(String[] args) {
        List<test> students = new ArrayList<>();
        test zhangsan = new test(";张三",";123456");
        test lisi = new test(";李四", ";123456");
        students.add(zhangsan);
        System.out.println(zhangsan.getName()+";来了");
        students.add(lisi);
        System.out.println(zhangsan.getName()+";来了");
        System.out.println(";点名"+zhangsan.getName());
        checkName(zhangsan.getName(),students);
        System.out.println(";点名"+lisi.getName());
        checkName(lisi.getName(),students);
        System.out.println(";冒泡排序");

        int[ ] array=new int[ ]{105,12,3,69,44};
        /*外循环为排序趟数，array.length个数进行array.length-1趟 */
        for(int i=0;i<array.length-1;i++){
            /*内循环为每趟比较的次数，第i趟比较array.length-i次 */
            for(int j=0;j<array.length-1-i;j++){
                /*相邻元素比较，若满足条件则交换（升序为左大于右，降序反之） */
                if(array[j]>array[j+1]){
                    int temp=array[j];
                    array[j]=array[j+1];
                    array[j+1]=temp;
                }
                /*查看每趟比较后的数组元素*/
                System.out.println(";第 "+(i+1)+"; 趟，第 "+(j+1)+"; 次比较后的结果：");
                for(int k=0;k<array.length;k++){
                    System.out.print(array[k]+"; ");
                }
                System.out.println();
            }
        }




    }
    private static void checkName(String name,List<test> students){
        for (test k : students){
            System.out.println(";队列的人有"+k.getName());
            k.answerName(name);
        }
    }
}
 